﻿<%@ Page Title="" Language="VB" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>

<%@ Import Namespace="Equipment.DataAccess" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Basic Requirements Setup
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="CurrentMenuIDContent" runat="server" >configMenu</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="HeadContent" runat="server">
    <link rel="stylesheet" type="text/css" href="../../Content/jquery-ui-1.8.16.custom.css" />
    <script type="text/javascript" src="../../Scripts/jquery-ui-1.8.16.custom.min.js"></script>
    <script type="text/javascript" src="../../Scripts/site.js"></script>
    <script type="text/javascript" src="../../Scripts/jquery.tablesorter.min.js"></script>
    <script type="text/javascript" src="../../Scripts/jquery.tablesorter.pager.js"></script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <table>
        <tr>
            <td colspan="2">
                <h2>
                    Basic Requirements Setup</h2>
            </td>
            <td width="100px">
                <form method="get" action='<%= Html.AttributeEncode(Url.Action("Create")) %>'>
                <input type="submit" class="button right" value="Create Requirement" />
                </form>
            </td>
            <td>
                <form id="print" method="post" target="_blank" onsubmit="print();" action='<%= Url.Content("~/Report/BasicRequirementReport") %>'>
                <input type="submit" class="button left" value="     Print     " />
                    <%= Html.Hidden("AssetTypeID")%>
                    <%= Html.Hidden("Frequency")%>
                </form>
            </td>
        </tr>
        <tr>
            <td width="150px">
                Filter By Asset Type:
            </td>
            <td width="200px">
                <%= Html.DropDownList("AssetType", "---All---")%>
            </td>
            <td colspan="2">
                &nbsp;
            </td>
        </tr>
        <tr>
            <td>
                Filter By Frequency:
            </td>
            <td>
                <select id="ddlFrequency">
                    <option value="" selected="selected">---All---</option>
                    <option value="Daily">Daily</option>
                    <option value="Weekly">Weekly</option>
                    <option value="Monthly">Monthly</option>
                </select>
            </td>
            <td colspan="2">
                &nbsp;
            </td>
        </tr>
        <tr>
            <td id="reqListContent" colspan="4">
                <% Html.RenderPartial("~/Views/BasicRequirements/Controls/RequirementGrid.ascx")%>
            </td>
        </tr>
        <tr>
            <td colspan="3">
            </td>
        </tr>
    </table>
    <% Html.RenderPartial("~/Views/History/Controls/History.ascx")%>
    <script type="text/javascript">

        $(document).ready(function () {
            $("select").change(function () {
                var assetTypeID = $("#AssetType").val();
                var frequency = $("#ddlFrequency").val();
                showLoading("reqListContent", true);
                jQuery.ajax({
                    type: 'POST',
                    data: { assetTypeID: assetTypeID, frequency: frequency },
                    url: '<%= Html.AttributeEncode(Url.Action("FilterRequirement")) %>',
                    success: function (result) {
                        $('#reqListContent').html(result);
                        hideLoading("reqListContent");
                    }
                });
            });

        });

        function print() {
            var assetTypeID = $("#AssetType").val();
            var frequency = $("#ddlFrequency").val();
            $("#AssetTypeID").val(assetTypeID);
            $("#Frequency").val(frequency);
            
        }

    </script>
</asp:Content>
